/**
 * Created by Administrator on 2017/4/8 0008.
 */
import React from "react";

export default class TotalCount extends React.Component{
    constructor(props){
        super(props)
        this.state={
            quantity:'',
            totalprice: ''
        }
    }

    componentWillMount(){

    }


    addview(){
        let totalprice = null;
        let quantity;
        if(!isNaN(this.state.totalprice)){
            totalprice =  (Number(this.state.totalprice)).toFixed(2)
        }else{
            totalprice = '输入数字不合法'
        }

        if(!isNaN(this.state.quantity)){
            quantity = this.state.quantity
        }else{
            quantity = '输入数字不合法'
        }


        switch (this.props.type){
            case"print":
                return(
                    <tr className="order_from_trcontext">
                        <td className="order_frorm_td order_from_td_num "/>
                        <td className="order_frorm_td order_from_td_total">合计</td>
                        <td className="order_frorm_td order_from_td_total" />
                        <td className="order_frorm_td order_from_td_total" />
                        <td className="order_frorm_td order_from_td_color" />
                        <td className="order_frorm_td order_from_td_total" />
                        <td className="order_frorm_td order_from_td_total" />

                        <td className="order_frorm_td order_from_td_pnum">{quantity}</td>
                        <td className="order_frorm_td order_from_td_ucost" />

                        <td className="order_frorm_td order_from_td_moeny">{totalprice}</td>
                        <td className="order_frorm_td order_from_td_moeny" />
                        <td className="order_frorm_td order_from_td_delandadd"/>
                    </tr>
                );
            case 'yarn':
                return(
                    <tr className="order_from_trcontext">
                        <td className="order_frorm_td order_from_td_num"/>
                        <td className="order_frorm_td order_from_td_snum order_from_td_total">合计</td>
                        <td className="order_frorm_td order_from_td_snum" />

                        <td className="order_frorm_td order_from_td_describe" />
                        <td className="order_frorm_td order_from_td_snum" />
                        <td className="order_frorm_td order_from_td_snum" />
                        <td className="order_frorm_td order_from_td_describe" />
                        <td className="order_frorm_td order_from_td_color" />


                        <td className="order_frorm_td order_from_td_total" />

                        <td className="order_frorm_td order_from_td_pnum">{quantity}</td>
                        <td className="order_frorm_td order_from_td_ucost" />
                        
                        <td className="order_frorm_td order_from_td_moeny">{totalprice}</td>


                        <td className="order_frorm_td order_from_td_moeny" />
                        <td className="order_frorm_td order_from_td_delandadd"/>
                    </tr>
                );
            case 'cloth':
                return(
                    <tr className="order_from_trcontext">
                        <td className="order_frorm_td order_from_td_num"/>
                        <td className="order_frorm_td order_from_td_snum order_from_td_total">合计</td>
                        <td className="order_frorm_td order_from_td_total" />
                        <td className="order_frorm_td order_from_td_describe" />
                        <td className="order_frorm_td order_from_td_size" />
                        <td className="order_frorm_td order_from_td_size" />
                        <td className="order_frorm_td order_from_td_size" />
                        <td className="order_frorm_td order_from_td_monad" />
                        <td className="order_frorm_td order_from_td_pnum">{quantity}</td>
                        <td className="order_frorm_td order_from_td_ucost" />

                        <td className="order_frorm_td order_from_td_moeny">{totalprice}</td>



                        <td className="order_frorm_td order_from_td_total" />
                        <td className="order_frorm_td order_from_td_delandadd"/>
                    </tr>
                );
            case"raw":
                return(
                    <tr className="order_from_trcontext">
                        <td className="order_frorm_td order_from_td_num "/>
                        <td className="order_frorm_td order_from_td_snum">合计</td>
                        <td className="order_frorm_td order_from_td_cnum" />
                        <td className="order_frorm_td order_from_td_describe" />
                        <td className="order_frorm_td order_from_td_color" />
                        <td className="order_frorm_td order_from_td_total" />

                        <td className="order_frorm_td order_from_td_pnum">{quantity}</td>
                        <td className="order_frorm_td order_from_td_ucost" />

                        <td className="order_frorm_td order_from_td_moeny">{totalprice}</td>
                        <td className="order_frorm_td order_from_td_total" />
                        <td className="order_frorm_td order_from_td_delandadd"/>
                    </tr>
                );
            case"gms":
                return(
                    <tr className="order_from_trcontext">
                        <td className="order_frorm_td order_from_td_num "/>
                        <td className="order_frorm_td order_from_td_po">合计</td>
                        <td className="order_frorm_td order_from_td_snum" />
                        <td className="order_frorm_td order_from_td_total" />
                        <td className="order_frorm_td order_from_td_cnum" />
                        <td className="order_frorm_td order_from_td_describe" />
                        <td className="order_frorm_td order_from_td_color" />
                        <td className="order_frorm_td order_from_td_sizemun" />
                        <td className="order_frorm_td order_from_td_sizemun" />
                        <td className="order_frorm_td order_from_td_ship" />
                        <td className="order_frorm_td order_from_td_monad" />
                        <td className="order_frorm_td order_from_td_pnum">{quantity}</td>
                        <td className="order_frorm_td order_from_td_ucost" />

                        <td className="order_frorm_td order_from_td_moeny">{totalprice}</td>
                        <td className="order_frorm_td order_from_td_moeny" />
                        <td className="order_frorm_td order_from_td_delandadd"/>
                    </tr>
                );
        }
    }

    render(){
        return (
            <thead>
            {
                this.addview()
            }
            </thead>

        )
    }
}
